Skip to content

fix(skills): scan a directory marketplace's live plugin directory - #23

Merged
zpyoung merged 2 commits into
mainfrom
zpyoung/fix-live-plugin-skill-roots
Aug 26, 2026
Merged

zpyoung merged 2 commits into
mainfrom
zpyoung/fix-live-plugin-skill-roots

Conversation

@zpyoung

@zpyoung zpyoung commented Aug 25, 2026 •

Copy link
Copy Markdown
Owner
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​683 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​683
Prod 7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​437 $\color{#cf222e}{\Huge{\mathbf{−}}}$​8 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​429

Problem

Claude Code installs a directory-sourced marketplace by copying it into ~/.claude/plugins/cache/, but it loads those plugins from the source directory in place. Orca's skill picker scanned the cache copy, so it offered whatever skill set existed at the last claude plugin update — not what the harness would actually load. Skills added to a locally-developed marketplace never appeared until the user remembered to re-run plugin update.

Approach

New Tier 1 fork feature at src/main/skills/fork-live-plugin-marketplaces/:

Module Role
live-plugin-marketplace-registry.ts Parses known_marketplaces.json, keeps only directory entries with an absolute installLocation
live-plugin-marketplace-override.ts Indexes installs by <installPath>/skills, resolves each manifest's plugins to their live skills dir, rewrites matching roots
live-plugin-marketplace-sources.ts Native entry point
live-plugin-marketplace-sources-wsl.ts WSL entry point

Two import-swap seams point the existing callers at the live variants:

  • src/main/skills/discovery.ts:20,277
  • src/main/skills/skill-discovery-wsl.ts:19,191

Details worth a second look

  • github/git marketplaces are left alone. Those really are copied into the cache, so the cached root already matches what the harness loads.
  • Plugin id suffix comes from the known_marketplaces.json key, never the manifest's own name. The two can disagree, and installs are recorded under the key.
  • Plugin source is confined to the install location. A ../ or absolute source resolves to null rather than escaping the marketplace directory.
  • The live root replaces the cached one rather than joining it, so a skill present in both cannot list twice.
  • Every failure degrades to the cached roots. Missing file, oversized file, malformed JSON, WSL timeout — a plugin is never dropped.
  • WSL costs at most two wsl.exe boots. known_marketplaces.json rides along in the metadata read that already happens, so a distro with no directory marketplace still costs exactly one; the manifest batch is the second and final one. Metadata is read inside the distro (not over UNC) so Windows path semantics never apply to guest files.

Fork ownership

  • Feature glob **/fork-live-plugin-marketplaces/** declared under features.
  • Both seams declared under seams with their lines verbatim; residuals re-baselined (discovery.ts 3/0 → 5/2, skill-discovery-wsl.ts 4/1 → 6/3).
  • Guard passes against upstream v1.4.187: no coverage, staleness, capture, seam, or residual findings.

Verification

  • pnpm typecheck — clean
  • pnpm lint (incl. localization extraction + coverage) — clean
  • pnpm test:sandbox on the feature — 4 files, 29 tests, all pass
  • Fork ownership guard — pass

Test coverage includes the WSL phase-1 batch's exact path list and order (the module slices it positionally) and a two-marketplace case proving each manifest stays aligned with its own live directory; that alignment assertion was mutation-checked by reversing manifestContents.

Adversarial review (/quirk:adversarial-review, Codex gpt-5.6-sol as cross-family reviewer) returned PASS: 0 blocking, 1 advisory since addressed, 1 finding refuted on miscited evidence.

Claude Code installs a `directory`-sourced marketplace by copying it into
`~/.claude/plugins/cache/`, but loads plugins from the source directory in
place. The skill picker scanned the cache copy, so it offered whatever skill
set existed at the last `claude plugin update` rather than what the harness
would actually load.

Fork feature `fork-live-plugin-marketplaces` reads `known_marketplaces.json`,
keeps only the `directory` entries, resolves each marketplace manifest's
plugins to their live `skills` directory, and repoints matching cache roots at
it. `github`/`git` marketplaces are untouched — their cache copy is what the
harness loads. Any read or parse failure degrades to the cached roots, so a
malformed registry never drops a plugin.

The WSL path batches `known_marketplaces.json` into the metadata read that
already happens, so a distro with no directory marketplace still costs exactly
one `wsl.exe` boot; the manifest read is a second and final one.

Two import-swap seams (`discovery.ts`, `skill-discovery-wsl.ts`) and the
feature glob are declared in the ownership manifest.
Copilot AI lite review requested due to automatic review settings August 25, 2026 22:04

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new native metadata reader uses a TOCTOU-prone stat() + readFile() pattern that can bypass the intended size cap and allow resource exhaustion from oversized marketplace files.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds a fork-owned “live plugin marketplaces” feature so Orca’s skill discovery repoints directory-sourced Claude marketplaces from the cached copy (~/.claude/plugins/cache/...) to the live marketplace directory that Claude actually loads, including a WSL implementation.

Changes:

  • Introduces fork-live-plugin-marketplaces/ to parse known_marketplaces.json, read marketplace manifests, and rewrite plugin scan roots to live skills/ directories.
  • Switches native + WSL skill discovery to call the new “live” discovery entrypoints via import-swap seams.
  • Adds unit tests covering native + WSL behavior, including batching/ordering guarantees and quoting behavior.
File summaries
File Description
src/main/skills/skill-discovery-wsl.ts Routes WSL plugin root discovery through the new live-marketplace implementation.
src/main/skills/discovery.ts Routes native plugin root discovery through the new live-marketplace implementation.
src/main/skills/fork-live-plugin-marketplaces/live-plugin-marketplace-sources.ts Native entrypoint: reads metadata + directory marketplaces and applies root overrides.
src/main/skills/fork-live-plugin-marketplaces/live-plugin-marketplace-sources.test.ts Native tests for live-root rewriting and failure degradation.
src/main/skills/fork-live-plugin-marketplaces/live-plugin-marketplace-sources-wsl.ts WSL entrypoint: batches metadata reads in-distro and applies overrides with a second manifest batch.
src/main/skills/fork-live-plugin-marketplaces/live-plugin-marketplace-sources-wsl.test.ts WSL tests for batching/ordering, quoting, --exec, and failure degradation.
src/main/skills/fork-live-plugin-marketplaces/live-plugin-marketplace-registry.ts Parses known_marketplaces.json and filters to absolute, directory-sourced marketplaces.
src/main/skills/fork-live-plugin-marketplaces/live-plugin-marketplace-registry.test.ts Tests for registry filtering and path resolution.
src/main/skills/fork-live-plugin-marketplaces/live-plugin-marketplace-override.ts Builds cache-path→plugin-id index, resolves live skill paths, and rewrites roots without duplication.
src/main/skills/fork-live-plugin-marketplaces/live-plugin-marketplace-override.test.ts Tests for install indexing, source containment, live-path mapping, and root rewrite semantics.
config/fork-ownership.json Declares the new Tier 1 feature glob and registers the two import-swap seams + residual updates.
Review details
  • Files reviewed: 11/11 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@zpyoung

zpyoung commented Aug 25, 2026

Copy link
Copy Markdown
Owner Author

@copilot-pull-request-reviewer Fixing. Will be in the next commit

@zpyoung

zpyoung commented Aug 25, 2026

Copy link
Copy Markdown
Owner Author

Fixing:

Will be in the next commit.

@zpyoung
zpyoung force-pushed the zpyoung/fix-live-plugin-skill-roots branch from f037e51 to 87434ee Compare August 26, 2026 14:45
@zpyoung
zpyoung merged commit 6348608 into main Aug 26, 2026
48 checks passed
zpyoung pushed a commit that referenced this pull request Oct 19, 2026
…nce off the deprecated owner resolver (stablyai#30484)

The eight mirroring callers (#23-#30) read the owner through
runtimeEnvironmentIdWithLegacyFallbackUnlessTwin, so a twin is still not mirrored. Sort-order
persistence (#2) leaves out ids that two hosts publish, and ids whose only server proof is a repo
row (isUnprovenServerSshRoute), instead of writing them to this desktop's or a guessed server's
meta. Deprecated importers 40 -> 31.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants